define(["jquery","core/util"],function($,util){
	
	var View={
		
		initView:function(_this){
			var d=$("#agent-grid");
			d.datagrid({
				fitColumns:true,
				url:"/agent/query/all",
				method:"get",
				columns:[[
			        {field:'jobId',title:'工号',width:"30%"},
			        {field:'business',title:'业务类型',width:"30%"},
			        {field:'status',title:'状态',width:"40%",formatter:util.agentStatus}
			    ]]
			})
			var d2=$("#session-status-grid");
			d2.datagrid({
				fitColumns:true,
				url:"/session/query",
				method:"get",
				columns:[[
			        {field:'jobId',title:'工号',width:"5%"},
			        {field:'sessionId',title:'会话ID',hidden:true},
			        {field:'keyId',title:'Key',width:"40%"},
			        {field:'channel',title:'渠道',width:"5%"},
			        {field:'createTime',title:'创建时间',width:"20%",formatter:util.timeFormat},
			        {field:'startTime',title:'服务时间',width:"20%",formatter:util.timeFormat},
			        {field:'status',title:'状态',width:"10%",formatter:util.sessionStatus}
			    ]]
			})
			
		}
		
	}
	
	function openWin(){
		var $div=$("<div/>").appendTo($("body"));
			$div.window({
				width:950,
				height:450,
				title:"系统监控",
				shadow:false,
				href:"plugs/monitor/template.html#test",
				onLoad:function(){
					var _this=$(this);
					View.initView();
				},
				onClose:function(){
					$div.window("destroy",true);
				}
			})
	}
	
	return {
		
		init:function(){
		},
		
		run:function(){
			openWin();
		}
		
	}
	
})